<!DOCTYPE html>
<html lang="zh-cmn-Hans" xmlns:th="http://www.thymeleaf.org">

<head th:replace="base/layout::header( ~{::title})">
    <title id="title">项目任务详情</title>
</head>
<body>
<div class="ui main container">
    <div class="ui clearing segment">
        <h3 class="ui header">项目任务详情</h3>
    </div>

    <!--模态框-->
    <div class="ui small modal">
        <i class="close icon"></i>
        <div class="content">
            确认导出列表？
        </div>
        <div class="actions">
            <div class="ui cancel button">取消</div>
            <div class="ui red approve button">确定</div>
        </div>
    </div>

    <div style="overflow: auto">
        <input type="hidden" id="pId" name="pId" th:value="${pId}">
        <table class="ui single line striped celled selectable table">
            <thead>
            <tr>
                <th colspan="18">
                    <button class="ui red button"
                            type="button" onclick="confirmExport();" style="margin-right: 20px">导出
                    </button>
                    <a class="ui grey button" th:href="@{/basicInfo/project}">返回</a>
                </th>
            </tr>
            <tr>
                <th>编号</th>
                <th>项目</th>
                <th>模块</th>
                <th>标题</th>
                <th>任务类型</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>报告人</th>
                <th>开发人</th>
                <th>测试人</th>
                <th>预计开发完成时间</th>
                <th>实际开发完成时间</th>
                <th>预计测试完成时间</th>
                <th>实际测试完成时间</th>
                <th>关闭时间</th>
                <th>开发工时（小时）</th>
                <th>测试工时（小时）</th>
                <th>总工时（小时）</th>
            </tr>
            </thead>
            <tbody th:if="${pageInfo}">
            <tr th:each="detail : ${pageInfo.list}">
                <td th:text="${detail.jiraNum}"></td>
                <td th:text="${detail.pName}"></td>
                <td th:text="${detail.cName}"></td>
                <td th:text="${detail.title}"></td>
                <td th:text="${detail.issueType}"></td>
                <td th:text="${detail.issueStatusStr}"></td>
                <td th:text="${detail.issueCreateTime}"></td>
                <td th:text="${detail.reporter}"></td>
                <td th:text="${detail.developer}"></td>
                <td th:text="${detail.tester}"></td>
                <td th:text="${detail.planDevelopedTime}"></td>
                <td th:text="${detail.actualDevelopedTime}"></td>
                <td th:text="${detail.planTestedTime}"></td>
                <td th:text="${detail.actualTestedTime}"></td>
                <td th:text="${detail.closeTime}"></td>
                <td th:text="${detail.developTimeSpent}"></td>
                <td th:text="${detail.testTimeSpent}"></td>
                <td th:text="${detail.iTotalTimeSpent}"></td>
            </tr>
            </tbody>
        </table>
        <div th:include="base/datatable::pagination" th:remove="tag"></div>
    </div>
</div>
<input id="errorMsg" type="hidden" th:value="${errorMsg}">
<div th:replace="common/footer::footer"/>
</body>

<script type="application/javascript">
    $(function () {
        var message = $('#errorMsg').val();
        if (message) {
            alert(message);
        }
    });

    // 导出确认框
    function confirmExport() {
        $('.ui.small.modal')
            .modal('show')
            .modal({
                closable: false,
                onApprove: function () {
                    var pId = $('#pId').val();
                    $.ajax({
                        type: "GET",
                        url: "/hades/basicInfo/projectDetailIsExport/" + pId,
                        dataType: "json",
                        success: function (data) {
                            if ("" === data.errorMsg) {
                                var url = "/hades/basicInfo/projectDetailExport/" + pId;
                                jQuery('<form action="' + url + '" method=post>' +  // action请求路径及推送方法
                                    '</form>')
                                    .appendTo('body').submit().remove();
                                /*window.location.href = "/hades/basicInfo/projectDetailExport/" + pId;*/
                            } else {
                                alert(data.errorMsg);
                            }
                        }
                    });
                }
            })
        ;
    }


</script>
</html>